// var p1 = './img/饿了么.png';
// var p2 = './img/订单.png';
// var p3 = './img/3.1我的.png';

var vm = new Vue({
    el: "#box",
    data: {
        active: 0,
        foots: 0,
        sort: ["综合排序", "距离最近", "销量最高", "筛选"],
        arr: ["年货节热卖", "津贴联盟", "满减优惠", "品质联盟"],
        logo: [
            { img: 'p1', text: '首页' },
            { img: 'p2', text: '订单' },
            { img: 'p3', text: '我的' }
        ],
        good: [
            {
                img: './img/good1.jpg',
                title: '黄焖鸡米饭(赛格店)',
                fen: '4.6',
                nums: '20',
                price: '15',
                min: '35',
                far: '3.4',

            },
            {
                img: './img/good2.png',
                title: '龙记猪脚饭',
                fen: '4.6',
                nums: '200',
                price: '12',
                min: '30',
                far: '1.6',
            },
            {
                img: './img/good3.png',
                title: '过桥米线',
                fen: '4.2',
                nums: '100',
                price: '8',
                min: '22',
                far: '1.2',
            }
        ],
        jian: ["35减12", "75减35", "100减45", "150减60"]
    },
    methods: {
        pink(index) {
            this.active = index;
            if (index == 1) {
                this.good.sort(
                    (a, b) => {
                        return (a.far / 1 < b.far / 1 ? -1 : (a.far / 1 > b.far / 1) ? 1 : 0)
                    }
                )
            } else if (index == 2) {
                this.good.sort(
                    (a, b) => {
                        return (a.nums / 1 > b.nums / 1 ? -1 : (a.nums / 1 < b.nums / 1) ? 1 : 0)
                    }
                )
            }
        },
        footClick(index) {
            this.foots = index
        },
    }
})